{include file="public/header" /}
<aside id="sitecontent" class="transition">
    {include file="public/search" /}
    <!-- main -->
    <div class="news-tabs dis-flex-between-center">
        {volist name="about_list" id="item" key="i"}
        <a href="{:url('about/index', ['id'=>$item.page_id])}">{$item.name}</a>
        {/volist}
        <a href="{:url('news/index', ['category_id'=>1])}" {if $category_id == 1}class="active"{/if}>公司日常</a>
        <a href="{:url('news/index', ['category_id'=>2])}" {if $category_id == 2}class="active"{/if}>装修小课堂</a>
    </div>
    <section class="p0-20 newsLst">
        <ul class="newslist dropLst">
            <!-- 8个 -->
            {volist name="data" id="item"}
            <li>
                <a href="{:url('news/detail', ['category_id'=>$item.category_id, 'id'=>$item.id])}" class="dis-flex-between-center">
                    <div class="img"><img src="{$item.thumb_url}" alt="{$item.name}"></div>
                    <div class="txt">
                        <div><strong>{$item.name}</strong></div>
                        <div class="color-6">{$item.description}</div>
                    </div>
                </a>
            </li>
            {/volist}
        </ul>
    </section>
    <!-- main end-->
    {include file="public/footer" /}
<script type="text/javascript">
    var tab1LoadEnd = false;
    var page=2;
    var category_id = "{$category_id}"
    var dropload = $('.newsLst').dropload({
        scrollArea : window,
        loadDownFn : function(me){
            $.ajax({
                type: "POST",
                url: "{:url('news/getDataList')}",
                data: {page:page, category_id:category_id},
                dataType: 'json',
                success: function(data){
                    if (data.code == 0){
                            var str = '';
                            $.each(data.data, function(i, vo) {
                                var pic = vo.thumb_url || '/static/mobile/images/news-img.jpg';
                                str += '<li>'
                                    +'<a href="'+vo.linkurl+'" class="dis-flex-between-center">'
                                    +'<div class="img">'
                                    +'<img src="'+pic+'" alt="'+vo.name+'" srcset="">'
                                    +'</div>'
                                    +'<div class="txt">'
                                    +'<div ><strong>'+vo.name+'</strong></div>'
                                    +'<div class="color-6">'+vo.description+'</div>'
                                    +'</div>'
                                    +'</a>'
                                    +'</li>';

                            });
                            $('.dropLst').append(str);
                            if(data.total_page > page){
                                page++;
                            } else {
                                tab1LoadEnd = true; // 数据加载完
                                me.lock(); // 锁定
                                me.noData(); // 无数据
                            }
                            me.resetload(); // 每次数据加载完，必须重置
                    } else{
                        myLayMsg(data.msg);
                    }
                },
                error: function(xhr, type){
                    myLayMsg('Ajax error!');
                    me.resetload();
                }
            });
            // 加载菜单二的数据
        }
    });
</script>